<?php
//抽象工厂模式abstract_factory
class Button {

}
class Border{}

class MacButton extends Button {}

class WinButton extends Button {}

class MacBorder extends Border {}

class WinBorder extends Border {}


interface AbstractFactory{
    public function CreateButton();
    public function CreateBorder();
}

class MacFactory  implements AbstractFactory{
    public function CreateButton()
    {
        // TODO: Implement CreateButton() method.
        return new MacButton();
    }
    public function  CreateBorder()
    {
        // TODO: Implement CreateBorder() method.
        return new MacBorder();
    }
}
class WinFactory implements AbstractFactory{
    public function CreateBorder()
    {
        // TODO: Implement CreateBorder() method.
        return new WinButton();
    }
    public function CreateButton()
    {
        // TODO: Implement CreateButton() method.
        return new WinBorder();
    }
}
$MacFactory = new MacFactory();
var_dump($MacFactory->CreateButton());
var_dump($MacFactory->CreateBorder());

$WinFactory = new WinFactory();

var_dump($WinFactory->CreateBorder());
var_dump($WinFactory->CreateButton());